package com.disdr.bean;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class ToSQL {


    public static void main(String[] args) throws IOException {
        FileReader fileReader = new FileReader("src\\main\\java\\com\\disdr\\bean\\test.txt");
        BufferedReader br = new BufferedReader(fileReader);
        String line = br.readLine();

        StringBuffer sb = new StringBuffer();
        StringBuffer sb1 = new StringBuffer();
        StringBuffer sb2 = new StringBuffer();
        StringBuffer sb3 = new StringBuffer();
        StringBuffer sb4 = new StringBuffer("{");

        StringBuffer sb5 = new StringBuffer();

        for(;line!=null;line = br.readLine()){

            String[] str = line.split("\t");
            String 驼峰式 = 驼峰式命名法.toCamelCase(str[0]);

            sb.append(str[0]).append(",");
            sb1.append(驼峰式).append(",");
            //#{item.activeShopId},
            String ss = "#{item." + 驼峰式 + "},";
            sb2.append(ss);
            //region_id = #{item.regionId},
            sb3.append(str[0]).append("=").append(ss);
            sb4.append("\""+str[0]+"\"").append(":").append("1,");

            sb5.append("<if test=\""+驼峰式+" != null \">and "+str[0]+" = #{"+驼峰式+"}</if>");
        }
        sb4.append("}");
        System.out.println(sb);
        System.out.println(sb1);
        System.out.println(sb2);
        System.out.println(sb3);
        System.out.println(sb4);
        System.out.println(sb5);
        /*for(;line!=null;line = br.readLine()){
            String[] str = line.split("\t");
            // active_shop = #{item.activeShop} ,
            System.out.println(str[1]+" = #{item." + toCamelCase(str[1]) + "},");
        }*/
    }


    public static String toType(String coluType){
        if(coluType.indexOf("bigint")>=0){
            return "Long ";
        }else if(coluType.indexOf("int")>=0){
            return "Integer ";
        }else if(coluType.indexOf("date")>=0){
            return "Date ";
        }else if(coluType.indexOf("varchar")>=0){
            return "String ";
        }else if(coluType.indexOf("decimal")>=0){
            return "BigDecimal ";
        }else{
            return "Object ";
        }
    }


}
